package io.renren.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.app.dao.BsBookcategoryDao;
import io.renren.modules.app.entity.BsBookcategoryEntity;
import io.renren.modules.app.service.BsBookcategoryService;
import org.springframework.stereotype.Service;
import java.util.Map;


@Service("bsBookcategoryService")
public class BsBookcategoryServiceImpl extends ServiceImpl<BsBookcategoryDao, BsBookcategoryEntity> implements BsBookcategoryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        LambdaQueryWrapper<BsBookcategoryEntity> queryWrapper = new LambdaQueryWrapper<>() ;
        if (params.get("catetypename") != null && !params.get("catetypename").equals("")){
            queryWrapper.like(BsBookcategoryEntity::getCatetypename,params.get("catetypename"));
        }
        IPage<BsBookcategoryEntity> page = this.page(
                new Query<BsBookcategoryEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}
